package com.eastfair.auth.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.eastfair.auth.enumeration.OrganizationOrgTypeEnum;
import com.eastfair.auth.enumeration.ResourceOrganizationResourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author ligang
 * @since 2021-07-19
 */
@Data
@ApiModel(value = "OrganizationSaveDTO", description = "")
public class OrganizationDTO implements Serializable {
    //校验标识
    public interface VerifyCreateOrgGroup {}
    public interface VerifyUpdOrgGroup {}


    public interface createBusNode {}
    public interface addCompanyByProject {}
    public interface updCompanyByProject {}

    public interface graftCompanyAdminUser {}
    public interface addUserOfAudience {}
    public interface addHostByProject {}
    public interface breakUseridOfCompany {}

    public interface addUseridOfCompany {}
    public interface updUseridOfCompany {}

    public interface createExhibition {}
    public interface addCompanyExhibition {}
    public interface removeCompany {}


    private static final long serialVersionUID = 1L;

    /**
     * 组织名称
     */
    @ApiModelProperty(value = "组织名称")
    @Size(max = 255, message = "组织名称长度不能超过255")
    @NotBlank(groups = {VerifyCreateOrgGroup.class,createBusNode.class,addCompanyByProject.class,addHostByProject.class,createExhibition.class,addCompanyExhibition.class,updCompanyByProject.class,VerifyUpdOrgGroup.class})
    private String name;

    /**
     * 组织类型 #{project_name:项目名称;exhibition:展会;p_company_classify:项目下的公司分类;e_company_classify:展会下的公司分类;p_sponsor_classify:项目下的主办;e_sponsor_classify:展会下的主办;e_audience_classify:展会下的观众分类;AUDIENCE_CLASSIFY:项目下的观众分类;company:公司;sponsor:主办;admin:管理员;staff:员工;other:其他}
     */
    @ApiModelProperty(value = "组织类型 #{project_name:项目名称;exhibition:展会;p_company_classify:项目下的公司分类;e_company_classify:展会下的公司分类;p_sponsor_classify:项目下的主办;e_sponsor_classify:展会下的主办;e_audience_classify:展会下的观众分类;AUDIENCE_CLASSIFY:项目下的观众分类;company:公司;sponsor:主办;admin:管理员;staff:员工;other:其他}")
    @NotNull(groups = {VerifyCreateOrgGroup.class,createExhibition.class})
    private OrganizationOrgTypeEnum orgType;
    /**
     * 组织code码
     */
    @ApiModelProperty(value = "组织code码")
    @Size(max = 255, message = "组织code码长度不能超过255")
    private String code;

    /**
     * 组织id
     */
    @ApiModelProperty(value = "组织id")
    @NotNull(groups = {graftCompanyAdminUser.class,VerifyUpdOrgGroup.class}, message = "组织id不能为空")
    private Long orgId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @NotNull(groups = {addUserOfAudience.class}, message = "项目id不能为空")
    private Long projectId;
    /**
     * 资源id
     */
    @ApiModelProperty(value = "资源id")
    @NotNull(groups = {createBusNode.class,addCompanyByProject.class,graftCompanyAdminUser.class,addHostByProject.class,breakUseridOfCompany.class,addUseridOfCompany.class,updUseridOfCompany.class,createExhibition.class,addCompanyExhibition.class,removeCompany.class,updCompanyByProject.class})
    private Long resourceId;


    /**
     * 目标资源id
     */
    @ApiModelProperty(value = "目标资源id")
    @NotNull(groups = {addCompanyExhibition.class})
    private Long targetResourceId;


    @ApiModelProperty(value = "资源类型 #{project:项目;company:公司;e_sponsor:展会;other:其他}")
    @NotNull(groups = {createBusNode.class,createExhibition.class})
    private ResourceOrganizationResourceTypeEnum resourceType;

    @ApiModelProperty(value = "用户id集合")
    @NotNull(groups = {addCompanyByProject.class,addHostByProject.class,addUseridOfCompany.class})
    private List<Long> userIds;

    @Excel(name = "父级id")
    @NotNull(groups = {VerifyCreateOrgGroup.class})
    private Long parentId;

    @ApiModelProperty(value = "用户id")
    @NotNull(groups = {updUseridOfCompany.class})
    private Long userId;

    /**
     * 组织id集合
     */
    @ApiModelProperty(value = "组织id集合")
    private List<Long> orgIds;

    /**
     * 角色id集合
     */
    @ApiModelProperty(value = "角色id集合")
    @NotEmpty(groups = {VerifyCreateOrgGroup.class,VerifyUpdOrgGroup.class})
    private List<Long> roleIds;
}
